<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <title><?php echo $store_name;?></title>
        <meta charset="UTF-8">
        <meta name="description" content="<?php echo $action['action_name'];?>">
        <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1">
        <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
        <script type='text/javascript' src='/public/js/jquery-3.1.1.min.js'></script>
        <script type="text/javascript" src='/public/js/jquery.validate.js'></script>
        <script>
            var _hmt = _hmt || [];
            (function () {
                var hm = document.createElement("script");
                hm.src = "//hm.baidu.com/hm.js?8d43b5b5d798921b66d689f7a792e6e2";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();
        </script>
        <script type="text/javascript">
            document.domain = '<?php echo _DOMAIN_ALL_;?>';
        </script>
        <link rel="shortcut icon" type="image/ico" href="/favicon.ico">
    </head>
    <body <?php  if(strstr($_SERVER['REQUEST_URI'],'user/passport/') ){ echo 'class="_login_backimg"';} ?> >
 
<link href="/public/css/main.css" rel="stylesheet">
<div class="container" style='font-size:10px;' >
    <div class='_main'>
        <div style='height:1.5rem'></div>
        <div class="<?php if(strstr($_SERVER['REQUEST_URI'],'user/passport/')){ echo '_banner';}else{ echo 'banner';}?>">
            <?php if(!strstr($_SERVER['REQUEST_URI'],'user/passport/')){?>
            <div class='_logo' style='height: 25rem'>
                <a href='#'><img src="/public/images/kaka.png" class='logo_img'  alt='banner' style="width:30%"/></a>
            </div>
            <?php } ?>
            <img src="<?php echo strlen($logo)<1?'/public/images/KAKA-LOGO.png':$logo;?>" class="<?php if(strstr($_SERVER['REQUEST_URI'],'user/passport/')){ echo '_banner_img'; }else{ echo 'banner_img'; }?>"  id='change'  alt='banner' />
            <?php if($barber['id']>0){?>
            <div style='text-align:center;width:13rem;height: 13rem;right:2%;margin-top:-9rem;position: absolute;z-index:100;background-color:white;border-radius:50%;'>
                <div style='height:12rem;width:12rem;margin:0.5rem auto'>
                <img src="<?php if(strlen($barber['photo'])>0){echo $barber['photo'];}else{echo '/public/images/tou.png';}?>" id='change'  style="width:100%;height: 100%;border-radius:50%;overflow:hidden;">
                </div>
                <div style='height:1rem'></div>
                <font style="font-size:1.5rem;color:black"><b><?php echo $barber['level'].' : '.$barber['name'];?></b></font>
            </div>
            <?php }?>
        </div>
 
<div class='_line'></div>
<div  style='float:left'>
    <b><a href="<?php echo shop_buildUrl("/user/action/"); ?>" style='font-size:1.5rem;color:black;' >活动 </a>&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="#" style='font-size:1.5rem;color:black;' >优惠劵 </a></b>
</div>
<div class='_line'></div>
<div class='_line'></div>
<div class='_cut2'></div>
<div id='content'>    
        <div id="appends">
        <?php foreach($coupons as $k=>$v){ ?>
        <?php if($k%3==0){?>
        
        <div class='row'>    
            <div class='col-sm-3 col-md-4'>
            <?php } ?>

            <div style='text-align:left;font:normal bold 20px/20px arial,sans-serif;color: #999999'><?php echo $v['name'] ?></div>
            <div class="thumbnail"  >
                <div  style="height:12rem;overflow: hidden">           	
                    <a href="/user/coupon/detail?store_id=<?php echo $v['store_id'] ?>&coupon_id=<?php echo $v['id'] ?>&barber_id=<?php echo $barber_id ?>"><img src="<?php echo $v['style']?>" width='100%'></a>
                </div>
            </div>
<!--             <div style='text-align:center;margin-top:-1.5rem;font-size:1.5rem;'>
             <span ><?php echo date('Y-m-d',$v['end_time']); ?>前使用 </span>
            </div> -->
            <div class='_line'></div>
        <?php if(($k+1)%3==0 || $coupons[$k+1]['id']<1){?>
        </div>

        <?php } ?> 
        <?php } ?>
        </div>
        </div>
         

<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> 
<script type='text/javascript'>
    var number = 12;
    function loaddata()
    {
        if(number ==-1){
            return;
        }
        totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());

        if ($(document).height() <= totalheight)
        {
            var barber_id = "<?php echo $barber_id ?>";
            $.ajax({ url: "/user/coupon/appendCheck?store_id=<?php echo (int)$_GET['store_id'];?>&start="+number,async:true, success: function(msg){
                    if(msg == 'false'){
                        number = -1;
                        return ;
                    }
                    var html = "";
                    msg = eval('(' + msg + ')');
                    $.each(msg,function(i,v){
                        if(i%4==0){
                            html += "<div class='row'>";
                            
                        }
                        html += "<div class='col-sm-3 col-md-4'>";
                        html += '<div style="text-align:center;font:italic bold 20px/20px arial,sans-serif;">';
                        html += v.name==null?'':v.name;
                        html += '</div><div class="thumbnail" ">';
                       
                        html += "<div class='caption'><a href='/user/coupon/detail?store_id=";
                        html += v.store_id==null?'':v.store_id;
                        html += "&coupon_id=";
                        html += v.id==null?'':v.id;
                        html += "&barber_id=";
                        html += barber_id==null?'':barber_id;
                        html += "'>";
                        html +="<img width='100%' src='";
                        html += v.style==null?'':v.style;
                        html += "'></a></div>";
                        html += "</div><div style='margin:-2rem 1rem 2rem 1rem;font-size:1.7rem;'>";
                        html += v.intro==null?'':v.intro;
                        html += "</div></div>";
                        if((i+1)%3==0){
                            html += "</div>";
                        }
                        number += 1;
                    });
                    $('#appends').append(html);
                    $.each(msg,function(i,v){
                        html +="<option value='";
                        html +=v.id==null?'':v.id;
                        html +="'>";
                        html +=v.content==null?'':v.content;
                        html +=v.type_name==null?'':v.type_name;
                        html +="</option>";

                    });
                    $('#type').append(html);
            }});
                //$("#container").append(text);
        }
    }

    $(window).scroll(function () {
        loaddata();
    });

   wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: '<?php echo WEIXIN_PAY_APP_ID;?>', // 必填，公众号的唯一标识
        timestamp: '<?php echo $data["timestamp"];?>', // 必填，生成签名的时间戳
        nonceStr: '<?php echo $data["noncestr"];?>', // 必填，生成签名的随机串
        signature: '<?php echo $data["sign"];?>',// 必填，签名，见附录1
        jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });
    wx.ready(function () {
    wx.onMenuShareTimeline({
        title: '<?php echo $coupons[0]["name"] ;?>', // 分享标题
        link: '<?php echo $data["url"];?>', // 分享链接
        imgUrl: '<?php echo "http://".MAIN_DOMAIN.$logo;?>', // 分享图标
        success: function () { 
            

        },
        cancel: function () { 
            // 用户取消分享后执行的回调函数

        },
        trigger: function(){
                alert("请点击您要分享的优惠劵,进入详情页再分享。");
                WeixinJsBridge.invoke('disabledShare',{},function(e){
                    //禁止用户分享错误的页面
                })
            }
    });
    wx.onMenuShareAppMessage({
        title: '<?php echo $coupons[0]["name"];?>', // 分享标题
        desc: '<?php echo $coupons[0]["intro"];?>', // 分享描述
        link: '<?php echo $data["url"];?>', // 分享链接
        imgUrl: '<?php echo "http://".MAIN_DOMAIN.$logo;?>', // 分享图标
        type: '', // 分享类型,music、video或link，不填默认为link
        dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
        success: function () { 
            // 用户确认分享后执行的回调函数

        },
        cancel: function () { 
            // 用户取消分享后执行的回调函数

        },
        trigger: function(){
                alert("请点击您要分享的优惠劵,进入详情页再分享。");
                WeixinJsBridge.invoke('disabledShare',{},function(e){
                    //禁止用户分享错误的页面
                })
            }
    });
    }); 
</script>
</div>
<div class="_line"></div>
<div class='box navbar-fixed-bottom' style='background-color:#dddddd;'>
    <button class="btn btn-primary btn-lg"  type="button" id='shop' style="width:17%;background-color:#dddddd;border-color:#dddddd;color:black;font-size:10px"><img src="/public/images/ShopList.png" style='width:30px' ><br>
        <span style='margin-left:-0.8rem' >商品中心</span></button>
    <button class="btn btn-primary btn-lg"  type="button" id='action' style="width:17%;background-color:#dddddd;border-color:#dddddd;color:black;font-size:10px"><img src="/public/images/ActivityCenter.png" style='width:30px' ><br><span style='margin-left:-0.8rem'>活动中心</span></button>
    <button class="btn btn-primary btn-lg"  type="button" id='kaka' style="width:27%;background-color:#dddddd;border-color:#dddddd;color:black;"><img src="/public/images/kaka2.png" class="img-circle" style='height:60px;width:60px;margin-left:-3rem;position:absolute;top:0.2rem;' ></button>
    <button class="btn btn-primary btn-lg"  type="button" id='cart' style="width:17%;background-color:#dddddd;border-color:#dddddd;color:black;font-size:10px"><img src="/public/images/ShopCart.png" style='width:30px' ><br>购物车</button>
     <button class="btn btn-primary btn-lg"  type="button" id='user' style="width:17%;background-color:#dddddd;border-color:#dddddd;color:black;font-size:10px"><img src="/public/images/UserCenter.png" style='width:32px' ><br><span style='margin-left:-0.8rem'>个人中心</span></button>
</div>
<div id='showCode' style="text-align:center;width:100%;height:100%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#8E8E8E',endColorstr='##8E8E8E');
    background-color:rgba(0, 0,0, 0.5);position:fixed; _position:absolute; top:0;left:0; z-index:5000;display:none "> 
    <div class="settle_div" >
        <div style='font-size:2rem'>门店信息</div>
        <div style='padding:4rem;'>
            <img src="<?php echo $logo ?>" style="width:80%" >
            <div style='font-size:1.5rem;' > <?php echo $store['name'] ?> </div>
            <div style='font-size:1.5rem;' >联系人： <?php echo $store['person_charge'] ?> </div>
            <div style='font-size:1.5rem;' >联系电话： <?php echo $store['tel'] ?> </div>
            <div style='font-size:1.5rem;' >地址： <?php echo $store['address'] ?> </div>  
        </div>
        <button class="btn btn-primary btn-lg"  type="button" id='hide' style="width:25%;background-color:#dddddd;border-color:#dddddd;color:black;">确定</button>
        <div class='_line'></div>
</div>

</div>
<div class='_line'></div>
</div>
    </body>
</html>
<script type="text/javascript">
    $(document).ready(function(){
        $('#shop').click(function(){
            window.location.href= '<?php echo shop_buildUrl("/user/shop"); ?>';
        });
        $('#action').click(function(){
            window.location.href= '<?php echo shop_buildUrl("/user/action"); ?>';
        });
        $('#kaka').click(function(){
            //门店信息
            $('#showCode').show();
        });
        $('#cart').click(function(){
            window.location.href= '<?php echo shop_buildUrl("/user/shop/shoppingcart"); ?>';
        });
        $('#user').click(function(){
            window.location.href= '<?php echo shop_buildUrl("/user/shop/personal"); ?>';
        });
        $('#hide').click(function(){
            //门店信息
            $('#showCode').hide();
        }); 
    })
</script>